package com.hopes.bizz.risk.activemq.log;

import com.hopes.bizz.risk.activemq.service.SysMqLogService;
import com.hopes.boss.admin.api.entity.SysMqLogEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author daijie
 * @version 1.0
 * @date 2023/8/18 9:54
 * @Description:
 */
@Component
public class ActiveMqLogger {
	@Autowired
	private SysMqLogService mqLogService;

	public void saveTenantMqLog(Boolean success, String textMessage, Date sendTime, String queue, String topic,
							   Integer deliveryMode, Integer acknowledgeMode, String errorCode, String detailMessage) {
		SysMqLogEntity mqLog = new SysMqLogEntity();
		mqLog.setSuccess(success);
		mqLog.setTextMessage(textMessage);
		mqLog.setSendTime(sendTime);
		mqLog.setQueue(queue);
		mqLog.setTopic(topic);
		mqLog.setDeliveryMode(deliveryMode);
		mqLog.setAcknowledgeMode(acknowledgeMode);
		mqLog.setErrorCode(errorCode);
		mqLog.setDetailMessage(detailMessage);

		mqLogService.save(mqLog);
	}
}
